<template>
  <view>
    <u-navbar :is-back="true" :is-fixed="true" title="详情"></u-navbar>
    <view class="dfes">
      <view class="font-12 pl-2 pt-2 text-999999">{{ source }}</view>
      <view class="font-12 pl-4 pt-2 text-999999">{{ time }}</view>
    </view>
    <view
      class="mt-3"
      style="
        width: 100vw;
        text-align: center;
        font-size: 1.3rem;
        font-weight: bold;
      "
      >{{ title }}</view
    >
    <view class="pl-2 pr-2 mt-6">
      <rich-text :nodes="richText"></rich-text>
    </view>
  </view>
</template>

<script>
import $H from "@/common/free-lib/request.js";

export default {
  data() {
    return {
      time: undefined,
      source: undefined,
      richText: '<div><p style="color:red;">这是一段富文本内容</p></div>',
    };
  },
  onLoad(option) {
    this.getPolicyRelease(option.id);
  },
  computed: {
    richTextNodes() {
      return this.parseHTML(this.htmlContent);
    },
  },
  methods: {
    getPolicyRelease(id) {
      $H.get(
        "/basisInform/policyRelease/queryById",
        {
          id,
        },
        {}
      ).then((res) => {
        if (!res.result) {
          uni.showToast({
            title: "未查询到相关信息",
            icon: "none",
          });
          return;
        }
        this.time = res.result.createTime;
        this.richText = res.result.content;
        this.source = res.result.source;
        this.title = res.result.title;
      });
    },
  },
};
</script>

<style>
</style>